﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace TheValueOfBitP
{
    class Program
    {
        static void Main(string[] args)
        {
            int v = 5;
            int p = 1;
            // Console.WriteLine(Convert.ToString(number,2).PadLeft(8,'0'));

            int mask = 1 << p;
            bool isOne = ((v & mask) >> p) == 1;
            Console.WriteLine("The pth bit is one: {0}", isOne);
        }
    }
}
